﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace PreventChess
{
    public partial class FrmNewGameSet : Form
    {
        public FrmNewGameSet()
        {
            InitializeComponent();
           
            this.combox_player_number.SelectedIndex = 0;
            this.combox_block_number.SelectedIndex = 0;
        }

        private void btn_cancel_Click(object sender, EventArgs e)
        {
            this.Close();
        }

        private void btn_ok_Click(object sender, EventArgs e)
        {
            FrmChessBoard frm_main = (FrmChessBoard)this.Owner; //子窗口调用父窗口方法和控件
            
            frm_main.PLAYER_NUMBER = this.combox_player_number.SelectedIndex + 2;
            frm_main.BLOCK_NUMBER = this.combox_block_number.SelectedIndex + 4;
            frm_main.IS_BORDER_ACROSS = this.checkbox_border_across.Checked;
            frm_main.IS_MOVE_LIMIT = this.checkbox_move_limit.Checked;

            frm_main.DrawChessBoard();
            this.Close();
        }
    }
}
